package com.manage.mapper;

import com.manage.pojo.UserBase;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

@Repository
public interface UserBaseMapper extends Mapper<UserBase> {

    @Insert("INSERT INTO tb_user_base_details (" +
            "base_job_id, details_id) VALUES (#{jobId},#{detailId})")
    int insertUserBaseAndUserDetails(@Param("jobId") Long jobId, @Param("detailId") Long detailId);

    @Insert("INSERT INTO tb_user_base_extensions (" +
            "base_job_id, extensions_id) VALUES (#{jobId},#{extensionId})")
    int insertUserBaseAndUserExtensions(@Param("jobId") Long jobId, @Param("extensionId") Long extensionId);

    @Delete("delete from tb_user_base_details where base_job_id=#{jobNumber}")
    void deleteUserBaseAndDetails(@Param("jobNumber")Long jobNumber);

    @Delete("delete from tb_user_base_extensions where base_job_id=#{jobNumber}")
    void deleteUserBaseAndExtension(@Param("jobNumber")Long jobNumber);
}
